#ifndef FASYS_LIBS_API_OPEN_SUBSCRIPTION_JSON_HPP
#define FASYS_LIBS_API_OPEN_SUBSCRIPTION_JSON_HPP

#include "open_subscription.hpp"
#include "names.hpp"
#include <fas/misc/json.hpp>

namespace fasys{ namespace api{

namespace aj = ::fas::json;
namespace ap = ::fas::pattern;

typedef
  aj::object<
    subscription_channel,
    ap::type_list_n<
        aj::member<n_channel, subscription_channel, std::string, &subscription_channel::channel>,
        aj::member<n_min_size, subscription_channel, size_t, &subscription_channel::min_size>,
        aj::member<n_max_size, subscription_channel, size_t, &subscription_channel::max_size>,
        aj::member<n_initial, subscription_channel, size_t, &subscription_channel::initial>
    >::type
  > channel_json;

typedef
  aj::object<
    open_subscription,
    ap::type_list_n<
        aj::member<n_lifetime, open_subscription, time_t, &open_subscription::lifetime>,
        aj::member<n_timeout, open_subscription, time_t, &open_subscription::timeout>,
        aj::member<n_channels, open_subscription, open_subscription::channel_list, &open_subscription::channels,
                  aj::array<channel_json> >
    >::type
  > open_subscription_json;

}}

#endif
